package morphage.gui;

import javax.swing.JPanel;
import java.awt.*;
import javax.swing.border.*;

public class AppCenterPanel extends JPanel 
{
	private static final long serialVersionUID = 1L;
	
	private static JPanel s_curMultiRenderViewPanel;
	
	public static void update()
	{
	  if( s_curMultiRenderViewPanel != null )
	    s_curMultiRenderViewPanel.repaint();
	}
	
	private class MultiRenderViewPanel extends JPanel
	{
		private static final long serialVersionUID = 1L;
		
		private AppRenderViewPanel[] 		m_appRenderViewPanel = new AppRenderViewPanel[3];
		public MultiRenderViewPanel()
		{
			m_appRenderViewPanel[ 0 ] = new AppRenderViewPanel( AppRenderViewPanel.LEFT_VIEW );
			m_appRenderViewPanel[ 1 ] = new AppRenderViewPanel( AppRenderViewPanel.CENTER_VIEW );
			m_appRenderViewPanel[ 2 ] = new AppRenderViewPanel( AppRenderViewPanel.RIGHT_VIEW );
			
			setLayout(new BorderLayout());
			add( "West", m_appRenderViewPanel[ 0 ] );
			add( "Center", m_appRenderViewPanel[ 1 ] );
			add( "East", m_appRenderViewPanel[ 2 ] );
		}
	}
	
	private MultiRenderViewPanel		   m_multiRenderViewPanel;
	private AppAnimationControlPanel   m_appAnimationControlPanel;
	
	public AppCenterPanel()
	{
		m_multiRenderViewPanel 		     = new MultiRenderViewPanel();
		m_appAnimationControlPanel	   = new AppAnimationControlPanel();
		
		s_curMultiRenderViewPanel = m_multiRenderViewPanel;
		
		setBorder(new EmptyBorder(4,4,4,0));
		setLayout(new BorderLayout());
		add("Center", 	   m_multiRenderViewPanel);
		add("South",	     m_appAnimationControlPanel);
	}
	 
	void exit() 
	{
	    System.exit(0);
	}
}
